<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IPagedList<TfsReports.Web.Models.Churn>>" %>
<%@ Import Namespace="TfsReports.Web.Extensions"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"><%=ViewData["Title"]%></asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <link type="text/css" rel="stylesheet" href="Content/smoothness/jquery-ui-1.7.2.custom.css" />
    <script type="text/javascript" src="Scripts/jquery-1.3.2.js"></script>
    <script type="text/javascript" src="Scripts/jquery-ui-1.7.2.custom.min.js"></script>
    <script type="text/javascript">
        $(function(){
            $('#start').datepicker({ showOn: 'button', buttonImage: 'Content/calendar.png', buttonImageOnly: true, dateFormat: 'yy-mm-dd', maxDate: '+0d', defaultDate: -21, changeMonth: true, changeYear: true, showButtonPanel: true, onClose: function(dateText, inst) { $('form').submit(); } }).css('width', '5em');
            $('#stop').datepicker({ showOn: 'button', buttonImage: 'Content/calendar.png', buttonImageOnly: true, dateFormat: 'yy-mm-dd', maxDate: '+0d', defaultDate: +0, changeMonth: true, changeYear: true, showButtonPanel: true, onClose: function(dateText, inst) { $('form').submit(); } }).css('width', '5em');
        });
    </script>
    <style type="text/css">
        div.clear { clear: both; }
        .right { text-align: right; }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% using (Html.BeginForm("Index", "Churn", new { start = Request["start"], stop = Request["stop"], personId = Request["personId"] }, FormMethod.Get, new { @class = "right" })){ %>
        <label for="start">Start:</label><%= Html.TextBox("start")%>
        <label for="stop">Stop:</label><%= Html.TextBox("stop")%><br />
    <% } %>
    <div class="clear"></div>
    <h2><%= ViewData["Title"] %></h2>
    
    <table>
        <thead>
            <tr>
                <th>Id</th>
                <th>Date</th>
                <th>Added</th>
                <th>Modified</th>
                <th>Deleted</th>
                <th>Person</th>
                <th>Work Item</th>
                <th>Changeset</th>
            </tr>
        </thead>
        <tbody>
        <% foreach (var item in Model) { %>
            <tr>
                <td><%= Html.ActionLink(item.Id.ToString(), "Details", new{id=item.Id}) %></td>
                <td><%= Html.Encode(item.Date) %></td>
                <td><%= Html.Encode(item.Change.LinesAdded) %></td>
                <td><%= Html.Encode(item.Change.LinesModified)%></td>
                <td><%= Html.Encode(item.Change.LinesDeleted)%></td>
                <td><%= Html.Encode(item.Person.Title) %></td>
                <td><%= Html.Encode(item.WorkItem.Title) %></td>
                <td><%= Html.Encode(item.Changeset.Title) %></td>
            </tr>
        <% } %>
        </tbody>
    </table>
    <% if (ViewData.Model.PageCount > 1){ %>
    <div class="pager"><%= Html.Pager(ViewData.Model.PageSize, ViewData.Model.PageNumber, ViewData.Model.TotalItemCount, new { start = Request["start"], stop = Request["stop"], personId = Request["personId"] })%></div>
    <% } %>
</asp:Content>